package com.dgut.hisystem.mapper;

import com.dgut.hisystem.entity.Advice;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AdviceMapper {
    @Select({"SELECT yz_id, cf_id, ys_id, yp_id, yz_amount, yz_price, yz_dosage, yz_remark FROM advice_info WHERE yz_id=#{id}"})
    Advice getAdviceById(int id);

    @Select({"Select * from advice_info where cf_id = ${id}"})
    List<Advice> getAdviceByPrescription(long id);

    void insert(Advice advice);

    void update(Advice advice);

    void delete(int id);

    @Delete({"Delete from advice_info where cf_id = #{id}"})
    void deleteByCf_id(long id);

    @Update({"UPDATE prescription_info SET cf_is_done = 1 WHERE cf_id = #{id}"})
    void donePrescription(long id);
}
